package com.fileshare.web.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class UploadItem {
    private boolean isFragment;
    private long offset;
    private String uploadName;
    private String originName;
    private InputStream fileContent;

    public UploadItem(String uploadName, File file) throws FileNotFoundException {
        this.uploadName = uploadName;
        this.fileContent = new FileInputStream(file);
    }

    public UploadItem(String uploadName, String filePath) throws FileNotFoundException {
        this.uploadName = uploadName;
        this.fileContent = new FileInputStream(filePath);
    }
}
